home *** CD-ROM | disk | FTP | other *** search
- Path: news-m01.ny.us.ibm.net!usenet
- From: cmahony@ibm.net (Colin Mahoney)
- Newsgroups: comp.lang.c++
- Subject: Re: seeking for c++ private base class inheritance examples
- Date: Mon, 22 Jan 1996 21:39:01 GMT
- Message-ID: <4e0um6$1fl6@news-s01.ny.us.ibm.net>
- References: <DL270x.KL9@hkpu01.polyu.edu.hk>
- NNTP-Posting-Host: slip139-92-41-247.emea.ibm.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- Sit Kwok Fu <cskfsit> wrote:
-
- >Hi,
- > This is my first time to ask for assistance by newsgroup. I am doing some
- >study about c++ private base class inheritance, but I could not find some good
- >examples and source codes to show the different situations of this kind of
- >inheritance. Does anybody know where I can grap some?
-
-
- >sit
- >Hong Kong Polytechnic University
-
- You can use private inheritance to inherit 'behaviour'.
-
- for example, I have a class which is more or less as follows:
-
- class Modeless
- {
- static List<const HWND&> WindowList;
-
- const HWND& hwndRef;
-
- public:
- Modeless( const HWND& hwnd ):
- hwndRef( hwnd )
- {
- WindowList.Add( hwnd );
- }
- ~Modeless()
- {
- WindowList.Remove( hwndRef );
- }
-
- static BOOL CheckMessage( LPMSG lpmsg );
- };
-
- I derive privately any windows I want to behave 'modelessly' ( ie have windows
- handle tabs etc for ) from this, then call 'CheckMessage' in my main event loop.
- There are no doubt other ways of doing this, but this one is easy to use and
- very flexible.
-
- --
- Colin Mahoney ( cmahony@ibm.net )
- Sabadell, Barcelona
- --
-
-